#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'

#define REP(i, x, y) for (auto i = (x), _##i = (y); i < _##i; ++i)
#define PER(i, x, y) for (auto i = (x), _##i = (y); i > _##i; --i)

template<class T=int>
inline void OO(const T &coll, const char *del = ",") {
    copy(coll.begin(), coll.end(), ostream_iterator<decltype(*coll.begin())>(cerr, del));
    cerr << endl;
}

const int maxn = static_cast<const int>(2e6 * 1.05);
ll a[maxn], dp[maxn], n;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        a[i] = i;
        dp[i] = dp[i - 1] + a[i];
    }
    ll tot = 0;
    for (int i = 0; i <= n; i++) {
        ll k = dp[i] + n;
        int j = lower_bound(dp + i + 2, dp + n + 1, k) - dp;
        if (dp[j] == k) {
            cout << i + 1 << " " << j << endl;
        }
    }


    return 0;
}
